/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.FeeScaleMapper;
import com.ybkj.daijia.server.model.FeeScale;
import com.ybkj.daijia.server.service.FeeScaleService;
import com.ybkj.daijia.server.service.SuperviceService;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author tanglei.
 *
 */
@Service
public class DefaultFeeScaleService implements FeeScaleService {

    @Autowired
    private FeeScaleMapper feeScaleMapper;

    @Autowired
    private SuperviceService superviceService;

    /**
     * 查询所有收费标准.
     */
    @Override
    public List<FeeScale> findAll() {
        return feeScaleMapper.selectAll();
    }

    @Override
    public int deleteById(Long id) {
        return feeScaleMapper.deleteById(id);
    }

    @Override
    public FeeScale findById(Long id) {
        return feeScaleMapper.findById(id);
    }

    @Override
    public int save(FeeScale feeScale) {
        feeScale.setCreated(new Date());
        return feeScaleMapper.insertFeeScale(feeScale);
    }

    @Override
    public int updateById(FeeScale feeScale) {
        return feeScaleMapper.updateById(feeScale);
    }

    @Override
    public boolean Report(FeeScale feeScale) {
        superviceService.YjxxMessage(feeScale);
        return true;
    }

    @Override
    public FeeScale findByFareType(String fareType) {
        return feeScaleMapper.findByFareType(fareType);
    }

    @Override
    public FeeScale findByFareTypeAndId(String fareType, Long feeId) {
        return feeScaleMapper.findByFareTypeAndId(fareType, feeId);
    }

}